﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL;
using BLL;
using System.Collections.Generic;

public partial class Baiviet_Traodoi : System.Web.UI.UserControl
{

    COMMENTBLL cmeBll = new COMMENTBLL();
    THANHVIENBLL tvBll = new THANHVIENBLL();

    protected void Page_Load(object sender, EventArgs e)
    {
        showAllComment();
    }

    public void showAllComment() {
        List<COMMENT> ListCme = cmeBll.getCommentWithIDBaiviet(Int32.Parse(Page.Request["mabv"]));
        string str_comment = "";
        foreach (COMMENT cme in ListCme) {
            THANHVIEN tv = tvBll.getThanhvienWithIDComment(cme.macomment);
            str_comment += "<div id=\"div_comment_1\" runat=\"server\">";
            str_comment += "<div class=\"blog_text_num\">";
            str_comment += "<big class=\"text_num\">";

            if(tv.hinh != ""){
                str_comment += "<img class=\"class_img_comment\" src=\"Hoso/hinh/Avatar/" + tv.mathanhvien + "/" + tv.hinh + "\"/>";
            }else{
                str_comment += "<img class=\"class_img_comment\" src=\"Hoso/hinh/Avatar/no_avatar.png\"/>";
            }

            str_comment += "</big></div>";
            str_comment += "<div style=\"width:640px;\"><a href=\"#\">" + tv.tenthanhvien + "</a><div class=\"com\">" + cme.ngaygui + "</div></div>";

            str_comment += "<p style=\"width:610px;min-height:40px;\">" + cme.noidung + "</p>";

        }
        div_comment_1.InnerHtml = str_comment;
    }
}
